<template>
    <LDrawerForm 
        :visible="visible"  
        :title="title"
        :isShowBootomButton="false"
        :component="myComponent"
        :componentParam="taskInfo"
        :width="width"
         @handleOk="handleOk" 
         @handleCancel="handleCancel"
         @handlerChange="handlerChange">

    </LDrawerForm>
</template>

<script>
import LDrawerForm from '@/components/lt/form/LDrawerForm'

export default {
    name: 'todoTaskForm',
    components: {
        LDrawerForm
    },
    data() {
        return {
            title: '详情',
            visible: false,
            myComponent: null,
            taskInfo: null,
            width:document.documentElement.clientWidth-400
        }
    },
    methods: {
        handleOk() {
            this.close()
        },
        handleCancel() {
            this.close()
        },
        handlerChange() {

        },
        open(taskInfo) {
            this.visible = true;
            if (taskInfo.templateName) {
                this.title = taskInfo.templateName
            }
            this.taskInfo = taskInfo
            if (taskInfo.formPath) {
                this.myComponent = (() => import(`@/views/${taskInfo.formPath}`))
            }
        },
        close() {
            this.$emit('close');
            this.visible = false;
        }
    }
}
</script>